package com.cloud.apigateway;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

/**
 * @EnableZuulProxy注解 开启Zuul的功能，服务网关
 *
 * 启动项目 eureka-server、eureka-client、eureka-consumer以及 api-getway
 * 网关zull 发现client和cunsumer后，自动创建两个路由规则
 * 1. 转发到eureka-client服务的请求规则为：/eureka-client/**
 * 2. 转发到eureka-consumer服务的请求规则为：/eureka-consumer/**
 *
 * 访问
 * http://localhost:1101/eureka-client/dc
 * http://localhost:1101/eureka-consumer/consumer
 *
 * 网关的路由配置
 * http://localhost:1101/api-a/dc
 * http://localhost:1101/api-b/dc
 */
@EnableZuulProxy
@SpringCloudApplication
public class ApiGatewayApplication {

	public static void main(String[] args) {
		SpringApplication.run(ApiGatewayApplication.class, args);
	}
}
